
//
//  XSJISawItVC.m
//  YCH
//
//  Created by yuanyuan he on 2019/6/18.
//  Copyright © 2019 KN. All rights reserved.
//

#import "XSJISawItVC.h"
#import "XSJISawItTableCell.h"
#import "SVProgressHUD.h"
#import "MJExtension.h"
#import "RefreshGifHeader.h"
//#import "WhoSeenModel.h"
//#import "http_my.h"

@interface XSJISawItVC ()

//@property (nonatomic, strong)WhoSeenListModel *listModel;

@end

@implementation XSJISawItVC

static NSString *const XSJISawItTableCellID = @"XSJISawItTableCellID";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"我看过的";
    [self setupTableView];
    [self setRightBarButton];
}

-(void)setRightBarButton
{
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"清空" style:UIBarButtonItemStylePlain target:self action:@selector(okButtonDidClick)];
    [self.navigationItem.rightBarButtonItem setTintColor:ColorHex(0x333333)];
}

-(void)okButtonDidClick
{
    //清空
//    YCHTransactionJXVC* vc = [[YCHTransactionJXVC alloc] init];
//    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)viewWillAippear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

-(void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    //    [self loadData];
}

#pragma mark - JXCategoryListContentViewDelegate

- (UIView *)listView {
    return self.view;
}

- (void)setupTableView
{
    self.tableView.estimatedRowHeight = 0;
    self.tableView.estimatedSectionHeaderHeight = 0;
    self.tableView.estimatedSectionFooterHeight = 0;
    self.tableView.backgroundColor = ColorHex(0xffffff);
    self.tableView.tableFooterView = [UIView new];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.alwaysBounceVertical=NO;
    
    [self.tableView registerClass:[XSJISawItTableCell class] forCellReuseIdentifier:XSJISawItTableCellID];
    
    //自定义刷新动画
//    ZWeakSelf
//    self.tableView.mj_header = [RefreshGifHeader headerWithRefreshingBlock:^{
//
//        [weakSelf loadData];
//    }];
//    [self.tableView.mj_header beginRefreshing];
    
}

//-(void)loadData
//{
//    ZWeakSelf
//    [http_my getScanMe:@"1" pageNum:10 success:^(id responseObject)
//    {
//        // 拿到当前的下拉刷新控件，结束刷新状态
//        [weakSelf.tableView.mj_header endRefreshing];
//        // 结束刷新
//        [weakSelf.tableView.mj_footer endRefreshing];
//        [weakSelf showData:responseObject];
//    } failure:^(NSError *error) {
//        // 拿到当前的下拉刷新控件，结束刷新状态
//        [weakSelf.tableView.mj_header endRefreshing];
//        // 结束刷新
//        [weakSelf.tableView.mj_footer endRefreshing];
//        [SVProgressHUD showErrorWithStatus:error.domain];
//    }];
//}

//-(void)showData:(id)responseObject
//{
//    if (kObjectIsEmpty(responseObject))
//    {
//        return;
//    }
//
//    self.listModel = [WhoSeenListModel mj_objectWithKeyValues:responseObject];
//    [self.tableView reloadData];
//}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    //return self.listModel.list.count;
    return 5;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    
    XSJISawItTableCell* scell = [tableView dequeueReusableCellWithIdentifier:XSJISawItTableCellID];
    scell = [[XSJISawItTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:XSJISawItTableCellID];
//    WhoSeenModel* model = [self.listModel.list objectAtIndex:indexPath.section];
//    scell.seenModel = model;
    
    cell = scell;
    
    return cell;
}


//每行的高度是多少
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0;
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView* view = [[UIView alloc]init];
    view.backgroundColor = [UIColor clearColor];
    return view;
}

#pragma mark - TableViewDelegate
//点击了哪个cell
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //    ZFMaterialAreaModel* materialAreaModel = [self.materialListModel.list objectAtIndex:indexPath.section];
    //    ZFMaterialVC *vc = [[ZFMaterialVC alloc]init];
    //    vc.materialAreaModel = materialAreaModel;
    //    [self.navigationController pushViewController:vc animated:YES];
}


//-(WhoSeenListModel *)listModel
//{
//    if (_listModel==nil)
//    {
//        _listModel = [[WhoSeenListModel alloc]init];
//        [_listModel setStartPage];
//    }
//
//    return _listModel;
//}


@end
